using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.SqlClient;

namespace THANHTUNGO.Portal.Helpers
{
    public class Select
    {
        public static DataSet FromQuery(string connectionName, string query)
        {
            SqlDatabase db = (SqlDatabase) DatabaseFactory.CreateDatabase(connectionName);
            SqlCommand dbCommand = (SqlCommand)db.GetSqlStringCommand(query);
            return db.ExecuteDataSet(dbCommand);
        }

        public static DataSet FromQuery(string query)
        {
            SqlDatabase db = (SqlDatabase) DatabaseFactory.CreateDatabase();
            SqlCommand dbCommand = (SqlCommand)db.GetSqlStringCommand(query);
            return db.ExecuteDataSet(dbCommand);
        }
    }
}
